package com.ruoyi.teacher.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.teacher.domain.vo.BarVO;
import com.ruoyi.teacher.domain.vo.PieVO;
import com.ruoyi.teacher.service.TransferService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 数据转换，用于图表内容的展示
 *
 * @author xiangzy
 * @date 2022-04-18
 */
@Api(tags = "图表数据查询")
@RestController
@RequestMapping("/teacher/transfer")
public class TransferController extends BaseController
{

    @Autowired
    private TransferService transferService;

    @ApiOperation(value = "柱状图展示数据")
    @GetMapping("/listTransfer")
    public AjaxResult listTransfer() {
        BarVO barVO = transferService.barVOList();
        return AjaxResult.success(barVO);
    }

    @ApiOperation(value = "学历展示数据")
    @GetMapping("/listDrgreeData")
    public PieVO listDrgreeData() {
        PieVO pieVO = transferService.PieVOList();
        logger.info("获取到的学历数据为{}",pieVO);
        return pieVO;
    }

    @ApiOperation(value = "折线图展示数据")
    @GetMapping("/listTitleData")
    public AjaxResult listTitleData() {
        BarVO barVO = transferService.listTitleLevel();
        return AjaxResult.success(barVO);
    }


}
